// 字典相关 API
import request from '@/utils/request';

// 获取字典数据
export function getDictData(dictType) {
  const apiUrl = `/system/dict/data/type/${dictType}`;

  
  return request({
    url: apiUrl,
    method: 'GET'
  }).then(data => {
  
    return data;
  }).catch(err => {
  
    throw err;
  });
}

// 获取多个字典数据
export function getMultipleDictData(dictTypes) {
  const promises = dictTypes.map(type => getDictData(type));
  return Promise.all(promises).then(results => {
    const dictMap = {};
    dictTypes.forEach((type, index) => {
      dictMap[type] = results[index];
    });
    return dictMap;
  });
}